<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" type="text/css" href="/css/regist.css" th:href="@{/css/regist.css}">
    <link rel="stylesheet" type="text/css" href="/css/common.css" th:href="@{/css/common.css}">
    <script type="text/javascript"  th:src="@{/js/jquery.min.js}" ></script>
    <script>
        $(function (){
            function is_null(str){
                if(str=='' || str==null) return true;
                else return  false;
            }
            $("#regist_btn").click(function (){
                var nikename = $("#nikename").val();
                var login_name = $("#login_name").val();
                var password = $("#password").val();
                if(is_null(nikename)||is_null(login_name)||is_null(password)){
                    alert("有空的哦")
                }else{
                    var data = {
                        nikeName:nikename,
                        loginName:login_name,
                        password:password,
                    }
                    $.ajax({
                        type:"post",
                        url:"/article/addUser",
                        data:data,
                        success:(res)=>{
                            if(res.code==200){
                                alert("注册成功");
                                window.location.replace("http://localhost:8085/login");
                            }else{
                                alert("注册失败")
                            }
                        }
                    })
                }
            })


        })
    </script>
</head>
<body>
<div class="item_div flex justify-center align-center">
    <div class="item_center p-3">
        <p class="text-center text-grey font-md">博客用户登录</p>
        <div class="flex flex-column align-center mt-2">
            <img th:src="@{/images/boke_touxiang.svg}" style="width: 60px;height: 60px;">
            <p class="font-mini text-grey mt-2">代码改变世界</p>
        </div>
        <div class="flex">

            <div class="left_item flex align-center justify-center flex-1">
                <a th:href="@{/login}">
                    <p class="font-mini">密码登录</p>
                </a>
            </div>

            <div class="right_item flex align-center justify-center flex-1">
                <p class="font-mini">注册账号</p>
            </div>
        </div>
        <div class="mt-2 flex flex-column">
            <input type="text" class="  font-mini" id="nikename" placeholder="请输入昵称"/>
            <input type="text" class="  font-mini mt-3" id="login_name" placeholder="登录用户名/邮箱"/>
            <input type="password" class=" mt-3  font-mini" id="password" placeholder="密码"/>
        </div>
        <div class="mt-5 flex justify-center align-center">
            <div class="item_btn flex align-center justify-center cursor-pointer" id="regist_btn">
                <p class="text-white font-mini">注册</p>
            </div>
        </div>
    </div>
</div>
</body>
</html>
